﻿/**
 * Created with JetBrains WebStorm.
 * User: Administrator
 * Date: 13-8-29
 * Time: 下午3:34
 * To change this template use File | Settings | File Templates.
 */

$(document).ready(function () {
   var AppRouter=Backbone.Router.extend({
       routes:{
           "/posts/:id":"getPost",				//<a href="#/posts/120">Post 120</a>
           "*actions":"defaultRoute",			//<a href="#actions">testActions</a>
           "/:route/:action":"loadView",		//<a href="#/dashboard/graph">Load Route/Action View</a>
           "/download/*path":"downLoadFile"		//<a href="#/download/user/images/hey.gif">download gif</a>
       },

       defaultRoute:function(actions){
           alert(actions);
       },

       getPost:function(id){
           alert(id);
       },

       downLoadFile:function(path){
           alert(path);
       },

       loadView:function(route,action){
           alert(route+"_"+action);
       }
   });

   var app_router=new AppRouter();
   Backbone.history.start();

    $("#testVal").click(function () {
        alert(JSON.stringify({hello:"world"}));
    });

});
